import React, { Component } from 'react';
import { MoreOutline, LeftOutline, EnvironmentOutline } from 'antd-mobile-icons'
import { Collapse, Empty } from 'antd-mobile'
import services from '../api/interface'
import '../style/Index/Order/ordermanage.css'
class Ordermanage extends Component {
    state = {
        ordList: []
    }
    onClick() {
        this.props.history.go(-1)
    }
    async componentDidMount() {
        var res = await services.cart.cart_list({ token: localStorage.getItem('token'), userid: localStorage.getItem('userid') })
        this.setState({
            ordList: res.data.data,
        })
    }
    render() {
        return (

            <div className='ordermanage' style={{ marginTop: '60px' }}>
                <div className='dnavbar'>
                    <span onClick={() => { this.onClick() }}><LeftOutline /></span>
                    <div>订单管理</div>
                    <div className='dmicon'>
                        <MoreOutline />
                    </div>
                </div>
                <div className="ordermain">
                    {
                        this.state.ordList == null ? <Empty description='没有新订单啦！' style={{ height: '160px' }} /> : this.state.ordList.map((item, index) => {
                            return (
                                <div className="orderList" key={index} >
                                    <div className="orderList_left">
                                        <img src={item.img1} alt="" />
                                    </div>
                                    <div className="orderList_right">
                                        <div className="order_text">
                                            {item.proname}
                                        </div>
                                        <div className="order_bot">
                                            <div className="order_price">
                                                ￥{item.originprice}
                                            </div>
                                            <div className="order_num">
                                                {item.num}
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            )
                        })
                    }
                </div>
            </div>
        );
    }
}

export default Ordermanage;